<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    for (let i = 0; i < 1; i++) {
      // random:生成0-1之间的随机数（包含0不包括1）
      console.log(Math.random());
      // ceil 向上取整
      console.log(Math.ceil(2.01));
      // floor 向下取整
      console.log(Math.floor(1.99));
      // max 找最大数
      console.log(Math.max(2, 6, 77, 8, 89, 88));
      // min 找最小数
      console.log(Math.min(2, 6, 77, 8, 89, 88));
      // pow 幂运算
      console.log(Math.pow(3, 6));
      //abs 绝对值
      console.log(Math.abs(-100));

      console.log(Math.ceil(Math.random()));  // 结果为1
    }
    // 1.如何生成0-10的随机数呢
    let re = Math.floor(Math.random() * (10 + 1))
    console.log(re);
    //2.如何生成5-10的随机数
    let re1 = Math.floor(Math.random() * (5 + 1)) + 5
    console.log(re1);
    //3.如何生成N-Mz之间的随机数
    let re2 = Math.floor(Math.random() * (M - N + 1)) + N
    console.log(re2);
  </script>
</body>

</html>